package com.lrabbit;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

@ServletComponentScan(basePackages = {"com.lrabbit.*", "com.lrabbit.common.**"})
@SpringBootApplication(scanBasePackages = {"com.lrabbit.rabbit.**", "com.lrabbit.manager*"})
@MapperScan(basePackages = {"com.lrabbit.**.mapper"})
@EnableScheduling
@EnableAsync
@Slf4j
@RefreshScope
@EnableDiscoveryClient
public class LittleRabbitApplication {

    public static void main(String[] args) {
        try {
            log.info("======================rabbit-manager start======================");
            ConfigurableApplicationContext context = SpringApplication.run(LittleRabbitApplication.class, args);
            log.info("日志: {}", (Object) context.getBeanDefinitionNames());
            log.info("======================rabbit-manager end========================");

        } catch (IllegalArgumentException e) {
            log.error("启动失败1: {}", e.getMessage(), e);
        } catch (Exception e) {
//            e.printStackTrace();
            log.error("启动失败2: {}", e.getMessage(), e);
        }
    }
}
